#include "Producer.h"
#include "Consumer.h"
#include "TaskQueue.h"
#include <iostream>
#include <thread>

using std::cout;
using std::endl;
using std::thread;

void test()
{
    TaskQueue taskQue(10);
    Producer pr;
    Consumer co;

    thread pro(&Producer::produce, &pr, std::ref(taskQue));//生产者线程
    thread con(&Consumer::consume, &co, std::ref(taskQue));//消费者线程

    //主线程等待生产者线程与消费者线程的退出
    pro.join();
    con.join();
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

